package com.ruoyi.web.controller.house;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.parameterQuery.domain.HouseDoorParameterQuery;
import com.ruoyi.parameterQuery.service.IHouseDoorParameterQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 户参数修改Controller
 * 
 * @author ruoyi
 * @date 2023-04-25
 */
@RestController
@RequestMapping("/house/parameterQuery")
public class HouseDoorParameterQueryController extends BaseController
{
    @Autowired
    private IHouseDoorParameterQueryService houseDoorParameterQueryService;

    /**
     * 查询户参数修改列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HouseDoorParameterQuery houseDoorParameterQuery)
    {
        startPage();
        List<HouseDoorParameterQuery> list = houseDoorParameterQueryService.selectHouseDoorParameterQueryList(houseDoorParameterQuery);
        return getDataTable(list);
    }

    /**
     * 导出户参数修改列表
     */
    @Log(title = "户参数修改", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HouseDoorParameterQuery houseDoorParameterQuery)
    {
        List<HouseDoorParameterQuery> list = houseDoorParameterQueryService.selectHouseDoorParameterQueryList(houseDoorParameterQuery);
        ExcelUtil<HouseDoorParameterQuery> util = new ExcelUtil<HouseDoorParameterQuery>(HouseDoorParameterQuery.class);
        util.exportExcel(response, list, "户参数修改数据");
    }

    /**
     * 获取户参数修改详细信息
     */
   @GetMapping(value = "/{parameterId}")
    public AjaxResult getInfo(@PathVariable("parameterId") Long parameterId)
    {
        return AjaxResult.success(houseDoorParameterQueryService.selectHouseDoorParameterQueryByParameterId(parameterId));
    }

}
